perm filename GFD.FIX[MF,ALS] blob
sn#797276 filedate 1985-07-01 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 @ @<Process the character locations in the postamble@>=
C00005 00003
C00013 ENDMK
C⊗;
@ @<Process the character locations in the postamble@>=
repeat k←gf_byte;
if (k=char_loc) or (k=char_loc+1) then
begin
c←gf_byte;
if c>max_char_no then abort('Character number too large');
if c<bc then bc←c; if c>ec then ec←c;
if k=char_loc then
begin dx[c]←signed_quad div 65536; dy←gf_signed_quad;
end
else begin dx[c]←gf_byte; dy←0;
end;
tfm_width[c]←signed_quad;
@!debug
gubed@/
print_ln(' k=',k:1,' c=',c:1,' dx=',dx[c]:1,' tfm width=',tfm_width[c]:1);
if tfm_width[c]<tfm_min then tfm_min←tfm_width[c];
if tfm_width[c]>tfm_max then tfm_max←tfm_width[c];
p←signed_quad;
k←no_op;
end;
until k≠no_op;
@<Make sure that the end of the file is well-formed@>;
@ @<Process the character locations...@>=
repeat k←get_byte;
if (k=char_loc) or (k=char_loc+1) then
begin
c←first_par(k); dx[c]←signed_quad;
if k=char_loc then dy←signed_quad else dy←0;
if c>max_glyph_no then abort('Character number too large');
tfm_width[c]←signed_quad;
if tfm_width[c]<tfm_min then tfm_min←tfm_width[c];
if tfm_width[c]>tfm_max then tfm_max←tfm_width[c];
print_ln('tfm width= ',tfm_width[c]:1);
p←signed_quad;
k←no_op;
end;
until k≠no_op;
@<Start translation...@>=
if o≤paint1+3 then @<Translate a sequence of |paint| commands,
until reaching a non-|paint|@>;
case o of
four_cases(skip0): @<Translate a |skip| command@>;
one_sixty_five_cases(new_row_0): @<Translate a |new_row| command@>;
@t\4@>@<Cases for commands |no_op|, |pre|, |post|, |post_post|, |boc|,
and |eoc|@>@;
four_cases(xxx1): @<Translate an |xxx| command@>;
yyy: @<Translate a |yyy| command@>;
othercases error('undefined command ',o:1,'!')
@.undefined command@>
endcases
@ @<Translate a |new_row| command@>=
begin
decr(n); p_c←0;
if p>0 then
begin p_val←white; p_array←p; incr(p_c);
end
else p_val←black;
if p<p_save then p_save←p; {used to reset |min_m| if necessary}
p_array←0; skip_flag←false; {a paint command that follows will be for black}
end
@ @<Translate a |skip| command@>=
begin p_c←0;
while p≥0 do
begin decr(n); p_val←white; p_array←0; paint_array[n,1]←0;
decr(p);
end;
skip_flag←true; { a paint command to follow will be for white}
end
@ @<Stow the glyph details@>=
max_column_count←0; {set for the glyph}
column_count←0;
row_count←0;
while true do begin
restart:
o←gf_byte;
case o of
sixty_four_cases(paint_0): begin
column_count←column_count+o-paint_0;
{|print_ln(' s0 ',o:1);|}
end;
paint1: begin
stow(o); o←gf_byte; column_count←column_count+o;
{|print_ln(' s1 ',o:1);|}
end;
paint2: begin
stow(o); o←gf_byte;
stow(o); column_count←column_count+256*o;
o←gf_byte; column_count←column_count+o;
end;
skip0: begin
incr(row_count);
if column_count>max_column_count then
max_column_count←column_count;
column_count←0;
end;
skip1: begin
stow(o); o←gf_byte;
row_count←row_count+1+o;
if column_count>max_column_count then
max_column_count←column_count;
column_count←0;
end;
one_sixty_five_cases(new_row_0): begin
incr(row_count);
if column_count>max_column_count then
max_column_count←column_count;
column_count←o-new_row_0;
end;
xxx1: begin
o←gf_byte;
while o>0 do begin q←gf_byte; decr(o); end;
goto restart;
end;
yyy: begin
o←5;
while o>0 do begin q←gf_byte; decr(o); end;
goto restart;
end;
no_op: goto restart;
eoc: goto done;
othercases
print_ln('! Unexpected command: ',o:1)
endcases;
stow(o);
end;
done:
stow(o); {this should be an |eoc| command}
{|print_ln('S EOC');|}
if column_count>0 then incr(row_count); {last row isn't terminated}
if column_count>max_column_count then max_column_count←column_count;
mm_store[m1_save,m2_save]←max_column_count div 256;
if m2_save<m2_max then incr(m2_save) else
begin m2_save←4; if m1_save<m1_max then incr(m1_save)
else m1_save←0;
end;
mm_store[m1_save,m2_save]←max_column_count mod 256;
if m2_save+3<m2_max then m2_save←m2_save+3 else
begin m2_save←m2_save+7-m2_max; if m1_save<m1_max then incr(m1_save)
else m1_save←0;
end;
mm_store[m1_save,m2_save]←row_count div 256;
if m2_save<m2_max then incr(m2_save) else
begin m2_save←4; if m1_save<m1_max then incr(m1_save)
else m1_save←0;
end;
mm_store[m1_save,m2_save]←row_count mod 256;
@p procedure do_im_bgly(@!c:integer);
var b,dis,n,i,q,val,w,real_w:integer;
q1,q2: integer;
bytes_required:integer; {bytes per row for current glyph}
begin
im_byte(im_bgly);
if c<128 then im_halfword(cur_font*128+c) {normal family and member name}
else im_halfword(im_extension[cur_font]*128+c-128);
{Imagen's family and member name}
q←pixel_width[data_base[cur_font]+c];
im_halfword(q); {advance width}
q←glyph_ptr[data_base[cur_font]+c];
{get starting location in |mm_store|}
q1← q div (m2_size); q2←q mod (m2_size);
@!debug
print(' im(',cur_font:1,')',c:1,'[',q1:1,',',q2:1,']');
gubed@/
bytes_required←((read_signed_pair(q)+7)div 8);
for i←1 to 8 do
begin
im_byte(mm_store[q1,q2]);
advance_q;
end; {width, left offset, height,top offset}
n←0; dis←0; val←0; w←0; real_w←0;
while real_w≠eoc do begin
@<Translate a sequence of paint commands@>;
w←mm_store[q1,q2];
real_w←w;
if (w≥new_row_0) and (w≤new_row_164) then
@<Translate a |new_row| command@>
else if (w≥skip0) and (w<new_row_0) then
@<Translate a |skip| command@>
else if real_w<>eoc then
print_ln('BAD D L COM ',w:1,' (',cur_font:1,')',c:1,'[',q1:1,',',q2:1,']');
end;
{|print_ln('G EOC');|}
glyph_ptr[data_base[cur_font]+c]←-glyph_ptr[data_base[cur_font]+c];
{to show that the glyph has been downloaded}
end;